﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Domain.Model.Project>>" %>

    <table>
        <tr>
            <th></th>
            <th>
                Name
            </th>
            <th>
                Description
            </th>
            <th>
                Status
            </th>
        </tr>

    <% foreach (var project in Model) 
       { 
            int programId = 0;

            if (project.Program != null)
                programId = project.Program.Id;    
           
    %>
        <tr>

            <td>
                <%: Html.ActionLink("View", "View", "Project", new { id = project.Id }, null) %> |
                <% if (Helpers.IsAdmin(this)){%>
                    <%: Html.ActionLink("Edit", "Edit", "Project", new { id = project.Id }, null) %> |
                    <%: Html.ActionLink("Delete", "Delete", "Project", new { id = project.Id, programId = programId }, null) %>
                <% } %>

            </td>
            
            <td>
                <%: project.Name %>
            </td>
            <td>
                <%: project.Description %>
            </td>
            <td align="center">
                <img src="../../Assets/<%: project.Status.StatusIndicator %>.png" height="20px" width="20px" alt="<%: project.Status.StatusIndicator %>" />
            </td>

        </tr>
    
    <% } %>

    </table>


